package cn.kgc.controller;

import cn.kgc.util.MailUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Rock
 * @create 2020-08-12 17:11
 */
@RestController
public class MailController {
    @Autowired(required = false)
    private MailUtil mailUtil;

    @RequestMapping(value = "/send",method = RequestMethod.GET)
    public String send(){
        String to = "417496479@qq.com";
        String subject = "3.26的测试信息";
        String context = "作业";
        mailUtil.send(to,subject,context);
        return "发送邮件完成！";
    }

    @RequestMapping(value = "/send2",method = RequestMethod.GET)
    public String send2(){
        String to = "417496479@qq.com";
        String subject = "报表文件";
        String context = "您好，附件是报表文件，请查收";
        String filepath = "F:\\学习笔记\\99 道 Java 多线程面试题，看完我跪了！.md";
        mailUtil.send2(to,subject,context,filepath);
        return "发送带附件邮件成功！";
    }
    @RequestMapping(value = "/send3",method = RequestMethod.GET)
    public String send3(){
        String to = "417496479@qq.com";
        String subject = "报表文件";
        String context = "<h1>您好，附件是报表文件，请查收</h1>";
        mailUtil.send3(to,subject,context);
        return "发送邮件完成！";
    }
}
